//
//  ClassTabBaeVC.m
//  XTeng
//
//  Created by 周成龙 on 16/8/12.
//  Copyright © 2016年 ZCL. All rights reserved.
//

#import "ClassTabBaeVC.h"

#import "VDJConstant.h"
#import "UIImage+image.h"
#import "ZNavigationController.h"

#import "ClassTableVC.h"
#import "SchoolVC.h"
#import "TestVC.h"
#import "UserVC.h"
#import "ChatVC.h"

@interface ClassTabBaeVC ()

@end

@implementation ClassTabBaeVC

+ (void)initialize
{
    // 获取当前这个类下面的所有tabBarItem
    UITabBarItem *item = [UITabBarItem appearanceWhenContainedIn:self, nil];
    // 创建属性字典
    NSMutableDictionary *att = [NSMutableDictionary dictionary];
    att[NSForegroundColorAttributeName] = kBlackFontColor;
    // 设置模型的标题属性修改控件的文字颜色
    [item setTitleTextAttributes:att forState:UIControlStateSelected];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUpAllChildViewController];
}
-(void)setUpAllChildViewController{
    
    TestVC * class = [[TestVC alloc]init];
    ZNavigationController * classNav = [[ZNavigationController alloc]initWithRootViewController:class];
    [self setOneChildViewController:classNav image:[UIImage imageNamed:@"考试灰"] selectedImage:[UIImage imageWithOriginalName:@"考试蓝"] title:@"考试"];
    
    ChatVC * chat = [[ChatVC alloc]init];
    ZNavigationController * chatNav = [[ZNavigationController alloc]initWithRootViewController:chat];
    [self setOneChildViewController:chatNav image:[UIImage imageNamed:@"沟通灰"] selectedImage:[UIImage imageWithOriginalName:@"沟通蓝"] title:@"沟通"];
    
    SchoolVC * school = [[SchoolVC alloc]init];
    ZNavigationController * schoolNav = [[ZNavigationController alloc]initWithRootViewController:school];
    [self setOneChildViewController:schoolNav image:[UIImage imageNamed:@"校园灰"] selectedImage:[UIImage imageWithOriginalName:@"校园蓝"] title:@"校园"];
}
-(void)setOneChildViewController:(UIViewController*)vc image:(UIImage*)image selectedImage:(UIImage*)selectedImage title:(NSString*)title
{
    vc.tabBarItem.title = title;
    vc.tabBarItem.image = image;
    vc.tabBarItem.selectedImage = selectedImage;
    [self addChildViewController:vc];
}

@end
